#ifndef MAINUI_H
#define MAINUI_H

#include <QObject>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QLineEdit>
#include <QListWidget>
#include <QJsonArray>
#include "jsonprase.h"
#include "Setupthread.h"
#include <QProgressDialog>
#include <QTimer>
#include <QPair>
#include <QComboBox>
#include <QToolBox>

#define MAIN         "Main"
#define ADVANCE      "Advanced"
#define BOOT         "Boot"
#define SECURITY     "Security"
#define SAVE_EXIT    "Save & Exit"
#define SAVE_EXIT_1  "Save_Exit"
#define BOOTODER     "UEFI mode defualt priority setting"   /* 兼容旧的启动顺序名称 */
#define SETUP        "Setup"
#define PLATHARDMON  "Platform Hardware Monitor"
#define Search       "Search"

#define MAXWAIT     1200

class MainUi : public QObject
{
    Q_OBJECT
public:
    explicit MainUi(QObject *parent = nullptr);
    void ExportShow(void);
    quint8 ParseCfgShow(void);
    void MainUiShow(void);

private:
     QString PlatInfo = "";
     QList<QString> PlatList = {"D2000/8", "FT-2500", "Hygon", "Loongson-3A", "SW", "FT-2000/4",
                                "FT2000PLUS", "3C5000L", "3A5000", "3C5000", "ZHAOXIN", "S5000C",
                                "3A6000", "Intel", "FT-D3000"};

     QVBoxLayout * AdvanceBox;
     QVBoxLayout * BootBox;
     QVBoxLayout * SearchBox;
     QVBoxLayout * SecurityBox;
     QVBoxLayout * MainBox;
     QVBoxLayout * Save_ExitBox;
     QWidget* MainWidget;
     QMetaObject::Connection timeconnect;
     QMetaObject::Connection Processconnect;
     QTabWidget *tabWidget;
     QPushButton *saveButton;
     QVBoxLayout* mainLayout;
     quint64 ulConfigIndex;
     int timecnt;
     JsonPrase *Json;
     SetupThread Setup;
     quint32 u32FormIndex;
     QProgressDialog *Dialog;
     QList<QPair<QComboBox *, QString>> BootOpList;
     quint8 u8BootIndex;
     QTimer timer;
     QMetaObject::Connection connection;

     void GetPlatInfo();
     void FormSetInit(QVBoxLayout **Layout, QString FormSetName);
     void ImportCfgShow(void);
     QVBoxLayout *FormCreate(QString FormName);
     QGridLayout *SubFormCreate(QVBoxLayout *Layout, QString SubFormName);
     void CheckBoxCreate(QGridLayout *CfgLayout, OptionCfg* pstcfg);
     void NumCfgCreate(QGridLayout *CfgLayout, OptionCfg* pstcfg);
     void OptionCfgCreate(QGridLayout *CfgLayout, OptionCfg* pstcfg);
     void StrCfgCreate(QGridLayout *CfgLayout, OptionCfg* pstcfg);
     void ListCfgCreate(QGridLayout *CfgLayout, OptionCfg* pstcfg);

};

#endif // MAINUI_H
